#ifndef NAMESPACE_H
#define NAMESPACE_H

#include "Program.h"

namespace FunctionViewer {
	class Namespace {
		friend class Main;
		friend class Program;
		friend class Class;
		friend class ClassContent;

		//variables.
		private:
		Program *program;

		unsigned long contentcount;

		char* nname;

		public:
		//Some variables for highest namespaces
		Namespace *prev, *next;
		//some variables for the other namespaces
		Namespace *v_namespace, *first, *last, *current;
		//Some class variables
		Class *first_class, *last_class, *current_class;

		unsigned long id;

		unsigned long namespace_counter, namespacecount;
		unsigned long class_counter, classcount;

		private:
		void Init(Program* program, char* name);
		void DeInit();

		//Create a namespace inside a namespace
		Namespace* CreateInNamespace(Namespace* _namespace, char* name);

		private:
		Class* AllocateClass();

		Class* CreateClass(char* v_name);
		void DestroyClass(Class* v_class);

		public:
		inline unsigned long GetID() {return id;}
		//Caches the id of this namespace to speed up the next call.
		inline void CacheID() {program->current_namespace = this;}
		inline Program* GetProgram() {return program;}
		inline Namespace* GetPrev() {return prev;}
		inline Namespace* GetNext() {return next;}
	};
}

#endif // NAMESPACE_H